class Solution(object):
    def generateParenthesis(self, n: int):
        List = []
        mid_num = 2 ** (2 * n - 1)
        while mid_num <= 2 ** (2 * n):
            mid_str = bin(mid_num)[2:]
            if self.str_youxiao(mid_str):
                mid_str = mid_str.replace("1", "(")
                mid_str = mid_str.replace("0", ")")
                List.append(mid_str)
                print(mid_num-256)
            mid_num += 2
        return List

    def str_youxiao(self, str):
        while "10" in str:
            str = str.replace("10", "")
        return str == ""

if __name__ == '__main__':
    fun = Solution()
    print(fun.generateParenthesis(5))
